
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using System.IO;


namespace IPickImporterUI
{
	public abstract class CustomerDevices
	{
		private long _CustomerDevicesID;
		private long _CustomerID;
		private string _DeviceName;
		private string _DeviceKey;
		private DateTime _DateCreated;
		private DateTime _DateInactive;
		private bool _isNew;

		#region Constructors
		
		public CustomerDevices()
		{
			_CustomerDevicesID = 0;
			_DateInactive = DateTime.Now;
		}
		
		public CustomerDevices(long CustomerDevicesID) : this()
		{
			_CustomerDevicesID = CustomerDevicesID;
		}
	
		public CustomerDevices(long CustomerDevicesID, long CustomerID, string DeviceName, string DeviceKey, DateTime DateCreated, DateTime DateInactive) : this()
		{
			_CustomerDevicesID = CustomerDevicesID;
			_CustomerID = CustomerID;
			_DeviceName = DeviceName;
			_DeviceKey = DeviceKey;
			_DateCreated = DateCreated;
			_DateInactive = DateInactive;
		}

		#endregion
		
		#region Properties
		
		public long CustomerDevicesID
		{
			get	{ return _CustomerDevicesID; }
			set	{ _CustomerDevicesID = value; }
		}
		
		public long CustomerID
		{
			get	{ return _CustomerID; }
			set	{ _CustomerID = value; }
		}
		
		public string DeviceName
		{
			get	{ return _DeviceName; }
			set	{ _DeviceName = value; }
		}
		
		public string DeviceKey
		{
			get	{ return _DeviceKey; }
			set	{ _DeviceKey = value; }
		}
		
		public DateTime DateCreated
		{
			get	{ return _DateCreated; }
			set	{ _DateCreated = value; }
		}
		
		public DateTime DateInactive
		{
			get	{ return _DateInactive; }
			set	{ _DateInactive = value; }
		}
		
		public bool IsNew
		{
			get 
			{ 
				_isNew = (_CustomerDevicesID == 0);
				return _isNew; 
			}
			set { _isNew = value; }
		}
		
		#endregion		

		
		/// <summary>
		/// Utility function that returns a DBNull.Value if requested. The comparison is done inline
		/// in the Insert() and Update() functions.
		/// </summary>
		private object SetNullValue(bool isNullValue, object value)
		{
			if (isNullValue)
				return DBNull.Value;
			else
				return value;
		}
	}
}
